package com.hnxxxy.statistics.controller;

import com.hnxxxy.common.AjaxRtnEntity.AjaxRtnEntity;
import com.hnxxxy.statistics.pojo.College;
import com.hnxxxy.statistics.service.SelectService;
import com.hnxxxy.sysmgr.pojo.Dict;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/select")
public class SelectController {

    @Autowired
    private SelectService selectService;


    @RequestMapping("/getCollegeSelectList")
    @ResponseBody
    public AjaxRtnEntity getSelectList(){
        List<Dict> dictList= selectService.getSeleCollegectList();
        AjaxRtnEntity ajaxRtnEntity=new AjaxRtnEntity(1,"",dictList);
        return ajaxRtnEntity;
    }

    @RequestMapping("/getMajorSelectList")
    @ResponseBody
    public AjaxRtnEntity getMajorSelectList(@RequestBody  Dict dict){
        System.out.println(dict.getGroupid());
        List<Dict> dictList= selectService.getMajorSelectList(dict.getGroupid());
        AjaxRtnEntity ajaxRtnEntity=new AjaxRtnEntity(1,"",dictList);
        return ajaxRtnEntity;
    }

    @RequestMapping("/getClassSelectList")
    @ResponseBody
    public AjaxRtnEntity getClassSelectList(@RequestBody  Dict dict){
        System.out.println(dict.getGroupid());
        List<Dict> dictList= selectService.getMClassSelectList(dict.getGroupid());
        AjaxRtnEntity ajaxRtnEntity=new AjaxRtnEntity(1,"",dictList);
        return ajaxRtnEntity;
    }


}
